#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
sys.path.append('../')

from models import LyricsParser


class TestLyricsParser(object):
    def setup(self):
        self.lyrics_parser = LyricsParser()
        self.lyrics_parser.artist = 'henriqueo'
        self.lyrics_parser.song = 'toply Song'

    def test_fix_html_common_semantic_issues(self):
        html = (
            '<p>Integer rutrum dolor non ultrices bibendum.<br />'
            'Donec quis nulla in elit condimentum porta.<br />'
            'Donec quis nulla in elit condimentum porta.<br />'
        )

        fixed_html = self.lyrics_parser.fix_html_common_semantic_issues(html)

        expected = (
            '<p>Integer rutrum dolor non ultrices bibendum.</p>'
            '<p>Donec quis nulla in elit condimentum porta.</p>'
            '<p>Donec quis nulla in elit condimentum porta.</p><p>')

        assert fixed_html == expected

    def test_clean_lyrics_keywords(self):
        summary = (
            'Video upload by: \n'
            '<html>\n'
            'Author: John Smith\n'
            'Integer rutrum dolor non ultrices bibendum\n'
            'Donec quis nulla in elit condimentum porta.')

        clear_lyrics = self.lyrics_parser.clean_lyrics_keywords(summary)

        expected = [
            'Integer rutrum dolor non ultrices bibendum',
            'Donec quis nulla in elit condimentum porta.']

        assert clear_lyrics == expected


